2 // Julian Rohrhuber, 2006
4 GUI.cocoa; // use Mac OS X native GUI
5 GUI.swing; // use Java GUI
9 var xx, yy, x, y, c, width, z=1, pp, zz=0, mm=10, alph=1.0, pen;
11 w = Window(Char.bullet, Rect(100, 100, 600, 600)).front;
12 w.view.background_(Color.gray(0.6));
14 v = UserView(w, w.view.bounds).mouseMoveAction_({|v,ax,ay|
18 [xx, yy].choose.value([5, -5, 2, -2, 8, -8].choose * 2);
25 xx = { |d=1| c = c.add((x = x + d) @ y ).keep(-150) };
26 yy = { |d=1| c = c.add(x @ (y = y + d)).keep(-150) };
29 [xx, yy].choose.value([10, -10, 5, -5, 2, -2].choose * 2);
35 try { pen.smoothing_(false) };
38 pen.strokeColor = Color.rand.alpha_(i.linexp(0, z-1, 1.0, alph));
40 c.size.do { |i| Pen.lineTo(c.wrapAt(i)) };
42 pen.translate([-2, -2, 2, 2] @@ zz, [-2, 2, -2, 2]*2 @@ zz);
46 if(z % mm == 0) { zz = zz + 1; mm = rrand(5, 20); alph = #[0.1, 1.0].choose };
49 fork {Êloop {Ê0.1.wait; defer {Êw.refresh; } } };
59 var xx, yy, x, y, c, d, width, viewheight;
60 var phunz, steps, nKeep, pen;
65 w = Window(Char.bullet, Rect(100, 100, 400, 400)).front;
66 w.view.background_(Color.black);
68 viewheight = w.bounds.height;
72 steps = #[1, 1, 2, 2, 2, 2, 4];
74 v = UserView(w, w.view.bounds);
75 v.mouseMoveAction_({|v,ax,ay|
80 v.mouseUpAction_({|v,ax,ay|
85 var scale = y.linexp(0, viewheight, 1, 40);
88 [xx, yy].choose.value(steps.choose * #[1, -1].choose * scale);
91 d = d.add(c).keep(nKeep.neg);
94 xx = { |d=1| c = c.add((x = x + d) @ y ) };
95 yy = { |d=1| c = c.add(x @ (y = y + d)) };
101 try { pen.smoothing_(false) };
108 pen.strokeColor = blend(
111 point.y.linlin(0, viewheight, 1, -1)
112 ).alpha_(point.y.linexp(0, viewheight, 0.5, 0.1));
117 d = d.deepCollect(2, { |x| x.y = x.y + 0.5 % viewheight });
121 {Êloop {Ê0.015.wait; w.refresh }}.fork( AppClock );
128 p = ProxySpace(s.boot);
130 p.clock = TempoClock.default;
133 q.sendData = {|q, data|
138 var xdata, ydata, xmul, ymul;
140 xdata = xdata.add(point.x);
141 ydata = ydata.add(point.y);
145 ugens = ugens.addAll([
146 LFPulse.ar(Duty.ar(0.4, 0, Dseq(xdata, inf) * xmul), 0, 0.5)
148 Formant.ar(Duty.ar(0.5 * ymul, 0, Dseq(ydata, inf) * ymul), 500, Duty.ar(0.02 * xmul, 0, Dseq(xdata, inf) * xmul))
152 LPF.ar(ugens.mean, 3000) * 0.2 ! 2